package com.kaikai.edusta.schedule;

import com.kaikai.edusta.service.StatisticsDailyService;
import com.kaikai.edusta.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class ScheduleTask {

    @Autowired
    private StatisticsDailyService service;
    @Scheduled(cron = "0 0 1 * * ? ")
    public void task1(){
        service.createStatisticsByDate(DateUtil.formatDate(DateUtil.addDays(new Date(), -1)));
    }
    //设置定时任务
    //http://cron.qqe2.com/
    //cron表达式 此处只能放6位



}
